/**
 *
 */
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;


init(config: OpenApi.Config){
  super(config);
  @endpointRule = '';
  
  checkConfig(config);
  @endpoint = getEndpoint('aliyunvnos', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }
  
  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model CheckServiceLinkedRoleForDeletingRequest {
  deletionTaskId?: string(name='DeletionTaskId', description='deletionTaskId'),
  roleArn?: string(name='RoleArn', description='roleArn'),
  serviceName?: string(name='ServiceName', description='ServiceName'),
  spiRegionId?: string(name='SpiRegionId', description='spiRegionId'),
}

model CheckServiceLinkedRoleForDeletingResponseBody = {
  code?: string(name='Code', description='code'),
  data?: {
    deletable?: boolean(name='Deletable'),
    roleUsageList?: [ 
      {
        region?: string(name='Region'),
        resourceList?: [ string ](name='ResourceList'),
      }
    ](name='RoleUsageList'),
  }(name='Data'),
  message?: string(name='Message', description='message'),
  requestId?: string(name='RequestId', description='requestId'),
  success?: boolean(name='Success', description='success'),
}

model CheckServiceLinkedRoleForDeletingResponse = {
  headers: map[string]string(name='headers'),
  body: CheckServiceLinkedRoleForDeletingResponseBody(name='body'),
}

async function checkServiceLinkedRoleForDeletingWithOptions(request: CheckServiceLinkedRoleForDeletingRequest, runtime: Util.RuntimeOptions): CheckServiceLinkedRoleForDeletingResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.deletionTaskId)) {
    query['DeletionTaskId'] = request.deletionTaskId;
  }
  if (!Util.isUnset(request.roleArn)) {
    query['RoleArn'] = request.roleArn;
  }
  if (!Util.isUnset(request.serviceName)) {
    query['ServiceName'] = request.serviceName;
  }
  if (!Util.isUnset(request.spiRegionId)) {
    query['SpiRegionId'] = request.spiRegionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CheckServiceLinkedRoleForDeleting',
    version = '2022-03-14',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function checkServiceLinkedRoleForDeleting(request: CheckServiceLinkedRoleForDeletingRequest): CheckServiceLinkedRoleForDeletingResponse {
  var runtime = new Util.RuntimeOptions{};
  return checkServiceLinkedRoleForDeletingWithOptions(request, runtime);
}

model SetUserSsoSettingsRequest {
  endUserUid?: long(name='EndUserUid', description='endUserUid'),
  reserved?: boolean(name='Reserved', description='reserved'),
}

model SetUserSsoSettingsResponseBody = {
  code?: string(name='Code', description='code'),
  data?: string(name='Data', description='data'),
  msg?: string(name='Msg', description='msg'),
  requestId?: string(name='RequestId', description='requestId'),
}

model SetUserSsoSettingsResponse = {
  headers: map[string]string(name='headers'),
  body: SetUserSsoSettingsResponseBody(name='body'),
}

async function setUserSsoSettingsWithOptions(request: SetUserSsoSettingsRequest, runtime: Util.RuntimeOptions): SetUserSsoSettingsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.endUserUid)) {
    query['EndUserUid'] = request.endUserUid;
  }
  if (!Util.isUnset(request.reserved)) {
    query['Reserved'] = request.reserved;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'SetUserSsoSettings',
    version = '2022-03-14',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function setUserSsoSettings(request: SetUserSsoSettingsRequest): SetUserSsoSettingsResponse {
  var runtime = new Util.RuntimeOptions{};
  return setUserSsoSettingsWithOptions(request, runtime);
}

